using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_ITEM_STATMap : EntityTypeConfiguration<SO_ITEM_STAT>
    {
        public SO_ITEM_STATMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Item__, t.Item, t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.Item__)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Item)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.Month)
                .HasMaxLength(2);

            this.Property(t => t.Year)
                .HasMaxLength(4);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(17);

            // Table & Column Mappings
            this.ToTable("SO_ITEM_STAT");
            this.Property(t => t.Item__).HasColumnName("Item_#");
            this.Property(t => t.Item).HasColumnName("Item");
            this.Property(t => t.QTY).HasColumnName("QTY");
            this.Property(t => t.Month).HasColumnName("Month");
            this.Property(t => t.Year).HasColumnName("Year");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
